home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20000824-20010305
/
000294_news@columbia.edu _Thu Feb 15 10:15:35 2001.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
4KB
Return-Path: <news@columbia.edu>
Received: from watsun.cc.columbia.edu (watsun.cc.columbia.edu [128.59.39.2])
by monire.cc.columbia.edu (8.9.3/8.9.3) with ESMTP id KAA10748
for <kermit.misc@cpunix.cc.columbia.edu>; Thu, 15 Feb 2001 10:15:34 -0500 (EST)
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id KAA23260
for <kermit.misc@watsun.cc.columbia.edu>; Thu, 15 Feb 2001 10:15:34 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id JAA14972
for kermit.misc@watsun.cc.columbia.edu; Thu, 15 Feb 2001 09:59:16 -0500 (EST)
X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
From: fdc@columbia.edu (Frank da Cruz)
Subject: Re: How to Delete files based on date
Date: 15 Feb 2001 14:59:16 GMT
Organization: Columbia University
Message-ID: <96gqs4$ejq$1@newsmaster.cc.columbia.edu>
To: kermit.misc@columbia.edu
In article <96gf2f$inb$1@boomer.cs.utexas.edu>,
Logan Shaw <logan@cs.utexas.edu> wrote:
: In article <3A8BB07A.B30F3D1D@eunet.no>,
: Halvor Nyberg <hnyberg@eunet.no> wrote:
: >Is it possible to delete all files in a directory which is older than
: >today.
:
: Do you believe that directories become write-protected when they
: are one day old? That is what your question sounds like. :-)
:
: But, I think you mean to ask if there is a way to scan a directory,
: find files which themselves are older than a day, and delete those
: files. Here is how to do that:
:
: cd /directory/name
: find . -type f -mtime +1 -exec rm {} \;
:
: This works recursively; it will scan not only files in that directory
: but ones in subdirectories.
:
It might be somewhat easier to do this with C-Kermit:
http://www.columbia.edu/kermit/ckermit.html
Look in the C-Kermit Script Library:
http://www.columbia.edu/kermit/ckscripts.html
in the File Management Scripts section. It really boils down to one
simple command:
delete [options] /before:today *
Options may include:
/after: /except: /noask /not-after:
/ask /heading /nodotfiles /not-before:
/before: /larger-than: /noheading /simulate
/dotfiles /list /nolist /smaller-than:
The time-oriented options take regular dates and times as arguments
as well as symbolic date-times such as TODAY, TOMORROW, YESTERDAY,
-5DAYS, +3MONTHS, etc, and functions are also provided to do any
desired kind of date arithmetic. For more info about this, see:
http://www.columbia.edu/kermit/case17.html
The file specification ("*" in the example) can be a C-Shell style
pattern for maximum flexibility in file selection, which is further
enhanced by options to include or exclude files based on other
criteria.
Later in this thread, the original poster said they did not want
the operation applied recursively. C-Kermit 7.0 does not delete
recursively. However, in case you DID want recursive deletion,
C-Kermit 7.1, now in testing:
http://www.columbia.edu/kermit/ck71.html
adds this option to the DELETE command:
/after: /except: /nodotfiles /recursive /type:
/ask /heading /noheading /simulate
/before: /larger-than: /nolist /smaller-than:
/directories /list /not-after: /summary
/dotfiles /noask /not-before: /tree
If you want recursive deletion, include the /RECURSIVE option; if you
don't, omit it. If you want to delete not only files but also
directories, include /DIRECTORIES; if not, don't include it, etc.
If you haven't looked at C-Kermit in a while, you might want to take
another look.
- Frank